import markdown, sys, os, time
def generate(content, time = None):
    return """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../../style.css">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
</head>
<body>
""" + markdown.markdown(content, extensions = ["markdown.extensions.extra"]) + "\n<br /><br />\n<small><small>Last Modified in " + time.ctime(os.path.getctime(sys.argv[1])) + "</small></small>\n</body>\n</html>"
if __name__ == '__main__':
    if len(sys.argv) <= 1:
	    sys.exit("no enough arguments")
    infile = open(sys.argv[1])
    outfile = open(os.path.splitext(sys.argv[1])[0] + '.html', 'w')
    outfile.write(generate(infile.read()))
